var disciplineList={};
$(document).ready(function(){ 
	var paraData = {teamId:teamId,tmGameId:tmGameId,startDate:startDate,endDate:endDate,tmScoreListId:tmScoreListId};
	$.getJSON(path+"/soccer/tmMemberAction!selectDisciplineList.action",paraData, function(data){
		disciplineList = data.disciplineList;
		var headerHtml=[];
	  	var disciplineHtml=[];
	  	var firstLogUserId="";//第一个用户
	  	var lastLogUserId="-1";//上一个用户
	  	var indexNo=0;
	  	$.each(disciplineList,function(index,obj){
	  		if(index==0){
	  			firstLogUserId=obj.logUserId;
	  		}
	  		if(obj.logUserId==firstLogUserId){
	  			headerHtml.push("<th nowrap='nowrap'>"+obj.itemName+"</th>");
	  		}
	  		if(obj.logUserId!=lastLogUserId){
	  			indexNo = indexNo+1;
	  			if(obj.logUserId!=firstLogUserId){
	  				disciplineHtml.push("</tr>");
	  			}
	  			disciplineHtml.push("<tr onclick='viewDetail("+obj.logUserId+",2);'>");
	  			disciplineHtml.push("<td nowrap='nowrap' style='color:yellow'>"+indexNo+"</td>");
		  		disciplineHtml.push("<td nowrap='nowrap' style='color:yellow'>"+obj.playerNo+"</td>");
		  		disciplineHtml.push("<td nowrap='nowrap' style='color:yellow'>"+obj.logUserName+"</td>");
		  		disciplineHtml.push("<td nowrap='nowrap' style='color:yellow;text-align:center'>"+(obj.itemValue=="0"?"":obj.itemValue)+"</td>");
	  		}else{
	  			disciplineHtml.push("<td nowrap='nowrap' style='color:yellow;text-align:center'>"+(obj.itemValue=="0"?"":obj.itemValue)+"</td>");
	  		}
	  		lastLogUserId=obj.logUserId;
	  	});
	  	disciplineHtml.push("</tr>");
	  	$("#headerTr").html($("#headerTr").html()+headerHtml.join("")); 
	  	$("#disciplineBody").html(disciplineHtml.join("")); 
	});
});
function viewDetail(logUserId,itemType){
	var timestamp = (new Date()).valueOf();
	backURL="/soccer/teamGameDataSet-discipline.jsp";
	window.location.href=path+"/soccer/teamGameDataPersonView.jsp?teamId="+teamId+"&tmGameId="+tmGameId+"&tmScoreListId="+tmScoreListId
	+"&startDate="+startDate+"&endDate="+endDate+"&playUserId="+logUserId+"&itemType="+itemType+"&backURL="+backURL+"&currentTab=disciplineLi"+"&timestamp="+timestamp;
}
